<!doctype html>
<html lang="zh-Hans">
<head>
    @import "mate.html"
    <title>自然个人税网上申报系统</title>
    <link rel="stylesheet" href="assets/weui/lib/weui.min.css">
    <link rel="stylesheet" href="assets/weui/css/jquery-weui.min.css">
    <!--<link rel="stylesheet" href="assets/webuploader/webuploader.css">-->
    <link rel="stylesheet" href="css/style.min.css">
    <script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
</head>
<body>
<!--<div class="nav-bar">-->
<!--&lt;!&ndash;<div class="nav-btn">-->
<!--<i></i>-->
<!--<i></i>-->
<!--<i></i>-->
<!--</div>&ndash;&gt;-->
<!--<p>自然人个税网上申报系统</p>-->
<!--</div>-->
<div class="swiper-container" data-space-between='10' data-pagination='.swiper-pagination' data-autoplay="1000">
    <div class="swiper-wrapper">
        <div class="swiper-slide">
            <img src="./images/banner.png" alt="">
        </div>
    </div>
</div>
<div class="type-title">
    <span>您当前安全登记：</span>
    <span class="A-color"></span>
    <span class="B-color"></span>
    <span class="C-color"></span>
    <span class="D-color"></span>
    <!--<i class="high"></i>-->
    <!--<i class="middle"></i>-->
    <!--<i class="low"></i>-->
</div>
<div class="weui-grids user-opt">
    <a id="test" href="javascript:" class="weui-grid js_grid" style="padding: 26px 20px;">
        <i class="index-4"></i>
        <p class="weui-grid__label">我要办税</p>
    </a>
    <a id="code" href="javascript:" class="weui-grid js_grid" style="padding: 26px 20px;">
        <i class="index-5"></i>
        <p class="weui-grid__label">正在办税</p>
    </a>
    <a href="cert/personCertInfo.html" class="weui-grid js_grid" style="padding: 26px 20px;">
        <i class="index-6"></i>
        <p class="weui-grid__label">实名认证</p>
    </a>
    <a href="taxReport/taxReport.html" class="weui-grid js_grid">
        <i class="index-1"></i><em class="user-opt-badge">9</em>
        <p class="weui-grid__label">纳税报告</p>
        <p class="weui-grid__label">微报告</p>
    </a>
    <a href="favorable/favReport.html" class="weui-grid js_grid">
        <i class="index-2"></i><em class="user-opt-badge">2</em>
        <p class="weui-grid__label">优惠报告</p>
        <p class="weui-grid__label">微报告</p>
    </a>
    <a href="riskReport/riskReport.html" class="weui-grid js_grid">
        <i class="index-3"></i>
        <p class="weui-grid__label">风险提示</p>
        <p class="weui-grid__label">微报告</p>
    </a>
</div>
<div class="weui-tabbar" style="position: fixed;">
    <a href="javascript:;" class="weui-tabbar__item weui-bar__item--on">
        <div class="weui-tabbar__icon navicon-one"></div>
        <p class="weui-tabbar__label">首页</p>
    </a>
    <a href="javascript:;" class="weui-tabbar__item">
        <div class="weui-tabbar__icon navicon-two"></div>
        <p class="weui-tabbar__label">办税</p>
    </a>
    <a href="javascript:;" class="weui-tabbar__item">
        <div class="weui-tabbar__icon navicon-thr"></div>
        <p class="weui-tabbar__label">实名认证</p>
    </a>
</div>

<!--chat代码开始-->
<!--小按钮-->
<a href="javascript:" class="open-popup" id="chat-btn" data-target="#chat"><i></i></a>
<!--弹出内容容器-->
<div id="chat" class="weui-popup__container" style="z-index: 501"><!-- popup-bottom-->
    <div class="weui-popup__overlay">聊天对话</div>
    <div class="weui-popup__modal">
        <div class="chat">
            <div class="toolbar">
                <div class="toolbar-inner">
                    <a href="javascript:;" class="picker-button close-popup">关闭</a>
                    <h1 class="title">工作人员XXX</h1>
                </div>
            </div>
            <div id="chat-box" class="chat-box">

                <div class="chat-time">2016年10月27日 17:30:59</div>

                <div class="my-chat">
                    <div class="chat-text">
                        <p class="text-content">依照税职依照税照税职职</p>
                    </div>
                    <div class="chat-head-img">
                        <img src="./images/chat-head-img.png" alt="" width="40px" height="40px">
                    </div>
                </div>

                <!--<div class="weui-loadmore weui-loadmore_line">
                    <span class="weui-loadmore__tips">历史记录</span>
                </div>-->

                <!--<div class="chat-time">2016年10月27日 17:30:59</div>-->

                <div class="his-chat">
                    <div class="chat-head-img">
                        <img src="./images/chat-head-img.png" alt="" width="40px" height="40px">
                    </div>
                    <div class="chat-text">
                        <p class="text-content"><img class="text-cont-img" src="./images/banner.png" alt=""></p>
                    </div>
                </div>

                <!--<div class="chat-time">2016年10月27日 17:30:59</div>-->

                <div id="view-el" style="width: 100%;height: 0"></div>
            </div>
            <div class="chat-input">
                <div class="input-cont" style="width: 75%">
                    <input id="my-text" class="weui-input" type="text" placeholder="请输入">
                </div>
                <div class="add-chatimg" style="width: 24%">
                    <label id="add-img" class="add-img"></label>
                    <button type="button" class="send-btn"></button>
                    <!--<input id="add-img" type="file" class="hidden">-->
                </div>
            </div>
        </div>

    </div>
</div>
<!--chat代码结束-->
<script src="./assets/jquery-3.2.1.min.js"></script>
<script src="./assets/weui/js/jquery-weui.min.js"></script>
<script src='./assets/weui/js/swiper.min.js'></script>
<script src='./js/load.js'></script>
<script src='./assets/webuploader/webuploader.html5only.js'></script>
<script>
  $(function () {
    $(".swiper-container").swiper();


    (function () {
      $.ajax({
        type:'get',
        url:'/get-sign',
        dataType:'json',
        data:{
          url:location.href
        },
        success:function (data) {
          console.log(data);
          wx.config({
            debug: true,
            appId: data.appid,
            timestamp: parseInt(data.timestamp),
            nonceStr: data.nonceStr,
            signature: data.signature,
            jsApiList: [
              'chooseImage',
              'onMenuShareTimeline',
              'onMenuShareAppMessage',
              'openLocation',
              'getLocation',
              'scanQRCode'
            ]
          });

          wx.ready(function(){
            wx.onMenuShareTimeline({
              title: '百度', // 分享标题
              link: location.href, // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
              imgUrl: '', // 分享图标
              success: function () {
                // 用户确认分享后执行的回调函数
              },
              cancel: function () {
                // 用户取消分享后执行的回调函数
              }
            });
          });

          $('#test').on('click',function () {
            wx.getLocation({
              type: 'wgs84', // 默认为wgs84的gps坐标，如果要返回直接给openLocation用的火星坐标，可传入'gcj02'
              success: function (res) {
                var latitude = res.latitude; // 纬度，浮点数，范围为90 ~ -90
                var longitude = res.longitude; // 经度，浮点数，范围为180 ~ -180。
                var speed = res.speed; // 速度，以米/每秒计
                var accuracy = res.accuracy; // 位置精度
                wx.openLocation({
                  latitude: latitude, // 纬度，浮点数，范围为90 ~ -90
                  longitude: longitude, // 经度，浮点数，范围为180 ~ -180。
                  name: '本地', // 位置名
                  address: '', // 地址详情说明
                  scale: 1, // 地图缩放级别,整形值,范围从1~28。默认为最大
                  infoUrl: '' // 在查看位置界面底部显示的超链接,可点击跳转
                });
              }
            });
          });

          $('#code').on('click',function () {
            wx.scanQRCode({
              needResult: 0, // 默认为0，扫描结果由微信处理，1则直接返回扫描结果，
              scanType: ["qrCode","barCode"], // 可以指定扫二维码还是一维码，默认二者都有
              success: function (res) {
                var result = res.resultStr; // 当needResult 为 1 时，扫码返回的结果
              }
            });
          });
        }
      })
    })();

    function showText() {
      document.getElementById('view-el').scrollIntoView();
      document.getElementById('chat-box').scrollTop = document.getElementById('chat-box').scrollHeight;
    }

    function addText(text) {
      var cont = $('<div class="my-chat">\n' +
        '                    <div class="chat-text">\n' +
        '                        <p class="text-content">' + text + '</p>\n' +
        '                    </div>\n' +
        '                    <div class="chat-head-img">\n' +
        '                        <img src="../images/chat-head-img.png" alt="" width="40px" height="40px">\n' +
        '                    </div>\n' +
        '                </div>');
      $('#view-el').before(cont);
      showText();
      if (cont.find('.text-cont-img').length) {
        cont.find('.text-cont-img').on('load', function () {
          showText();
        })
      }
    }

    $(window).on('resize', function () {
      showText();
    });
    var pb = null;
    $('div.chat-box').on('click', 'img.text-cont-img', function () {
      var imgUrl = $(this).attr('src');
      pb = $.photoBrowser({
        items: [imgUrl]
      });
      pb.open();
    });

    $('.send-btn').on('click', function () {
      var text = $('#my-text').val().trim();
      if (text !== '') {
        addText(text);
        $('#my-text').val('').focus();
      }
    });
    /*$("#my-text").keypress(function (event) {
      if (event.which === 13) {
        var text = $('#my-text').val().trim();
        if (text !== '') {
          addText(text);
          $('#my-text').val('').focus();
        } else {
          $.alert('请输入内容');
        }
      }
    });*/

    (function () {
      var uploader = WebUploader.create({
        auto: true,
        fileVal: 'uploadImg',
        compress: {
          width: 400,
//          height: 500,
          quality: 90,
          // 是否允许放大，如果想要生成小图的时候不失真，此选项应该设置为false.
          allowMagnify: false,
          // 是否允许裁剪。
          crop: false,
          // 是否保留头部meta信息。
          preserveHeaders: true,
          // 如果发现压缩后文件大小比原来还大，则使用原来图片
          // 此属性可能会影响图片自动纠正功能
          noCompressIfLarger: false,
          // 单位字节，如果图片大小小于此值，不会采用压缩。
          compressSize: 0
        },
        server: '../uploadImg/khgl/sysFiles/uploadFileForEditor2.shtml',
        pick: '#add-img',
        accept: {
          title: 'Images',
          extensions: 'gif,jpg,jpeg,bmp,png',
          mimeTypes: 'image/*'
        }
      });

      // 当有文件添加进来的时候
      uploader.on('fileQueued', function (file, data) {
        $.showLoading('正在上传');
      });

      // 文件上 b   传成功
      uploader.on('uploadSuccess', function (file, data) {
        $.hideLoading();
        uploader.removeFile(file, true);
        var img = '<img class="text-cont-img" src=' + data.data.src + '>';
        addText(img);
      });

      // 文件上传失败，上传出错
      uploader.on('uploadError', function (file) {
        $.hideLoading();
        $.alert('上传出错，请重新上传');
      });

      // 完成上传完了
      uploader.on('uploadComplete', function (file) {

      });
    })();

  })
</script>
</body>
</html>